package com.management.vtribe.service;

import com.management.vtribe.Bean.Manager;
import com.management.vtribe.mapper.ManagerMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class ManagerService {
    @Autowired
    ManagerMapper managerMapper;

    public Manager verifyManager(String username, String password){
        if(username==null||password==null||username.equals("")||password.equals("")){
            return null;
        }else {
            Manager manager = managerMapper.getManagerByUsername(username);
            if(manager==null){//没查到返回的user会是null
                return null;
            }else{
                if(password.equals(manager.getPassword())){
                    return manager;
                }else{
                    return null;
                }
            }
        }
    }

    public Manager getManagerByUsername(String username){
        return managerMapper.getManagerByUsername(username);
    }
}

